<style lang = 'less'>
.SettleExchangePrepare{
  .select{
    position: relative;
    display: inline-block;
    width: 0.28rem;
    height: 0.28rem;
    border: 1px solid #bfbfbf;
    margin-left:0.6rem;
    margin-right:0.21rem;
    vertical-align: top;
    &>img{
      position:absolute;
      top: 0px;
      left: 0px;
      width: 100%;
    }
  }
  .deal{
    margin-top: 0.28rem;
    padding-left: 0.3rem;
    overflow: hidden;
    &>p{
      float: left;
      width:6.43rem;
      font-size:0.26rem;
      line-height: 0.35rem;
      color: #ccc;
      .dealCheck{
        color: #3333ff;
      }
    }
    &>i{
      float: left;
      margin-left: 0px;
      margin-right: 0.15rem;
      &>img{
        vertical-align: top;
        width: 100%;
        height: auto;
      }
    }
  }
  .null-box{
    width: 100%;
    height: .2rem;
    background-color: #FAFAFA;
  }
  .submit-btn{
    width: 6.9rem;
    height: .88rem;
    background-color: #EC1B30;
    color: #FFFFFF;
    font-size: .34rem;
    text-align: center;
    line-height: .88rem;
    border-radius: .06rem;
    margin: 0.39rem auto 0;
  }
}
</style>
<template>
  <div class="dy-main SettleExchangePrepare">
    <div class="dy-header">
      <x-header :right-options="{showMore: false}" :left-options="{preventGoBack:true}" @on-click-back="back" @on-click-more="showMenus = true">结汇</x-header>
    </div>
    <div class="dy-body">
      <div class="dy-wapper">
        <scroller lock-x style="height:100%;">
          <div class="scroller-box">
            <group gutter='.1rem' label-width="" title="">
              <cell :title="('结汇账号')" @click.native="showPopupPicker1 = true" :value="value1[0]" is-link></cell>
              <cell title="货币余额" :value="BuyCurrency + '美元'"></cell>
              <cell title="本年度剩余结汇额度" :value="surplusLimit + '美元'"></cell>
              <cell title="本年度已用结汇额度" :value="surplusLimitUsed + '美元'"></cell>
              <cell title="参考汇率" :value="changeRate"></cell>
              <x-input title="结汇金额(美元)" placeholder="请输入结汇金额" v-model="buyExchangeAmt" placeholder-align="right" text-align="right"></x-input>
              <cell title="本次结汇折合人民币" :value="changeRMBAmt+ '元'"></cell>
              <cell :title="('资金来源')" @click.native="showPopupPicker2 = true" :value="value2[0]" is-link></cell>
              <cell :title="('入账账号')" @click.native="showPopupPicker3 = true" :value="value3[0]" is-link></cell>
              <div class="null-box"></div>
              <cell :title="('电子银行个人结售汇服务须知')" :link="{path:'/BuyExchangeResult'}" inline-desc=''></cell>
            </group>
            <group gutter='.1rem'>
              <popup-picker :show.sync="showPopupPicker1" :show-cell="false" :data="list1" v-model="value1"></popup-picker>
              <popup-picker :show.sync="showPopupPicker2" :show-cell="false" :data="list2" v-model="value2"></popup-picker>
              <popup-picker :show.sync="showPopupPicker3" :show-cell="false" :data="list3" v-model="value3"></popup-picker>
            </group>
            <div class="deal">
              <i class='select' @click='forginClick'><img src="../../../assets/img/Financial/selected.png" alt="" v-show="forgin"></i>
              <p>我已阅读并同意电子银行个人结售汇服务须知</p>
            </div>
            <div @click="gotoNext" class="submit-btn">下一步</div>
          </div>
        </scroller>
      </div>
    </div>
    <div class="dy-footer"></div>
  </div>
</template>

<script>
export default {
  mounted () {

  },
  data () {
    return {
      BuyCurrency: '4000',
      changeRMBAmt: '4567.00',
      surplusLimit: '65423',
      surplusLimitUsed: '65423',
      useType: '旅游',
      changeRate: '2.34',
      buyExchangeAmt: '',
      value1: ['请选择'],
      list1: [['请选择', '6223 **** **** 1111', '6223 **** **** 2222', '6223 **** **** 3333']],
      value3: ['请选择'],
      list3: [['请选择', '6223 **** **** 4567', '6223 **** **** 7655', '6223 **** **** 7654']],
      value2: ['职工报酬'],
      list2: [['职工报酬', '外块收入', '房租收入', '商务收入']],
      forgin: '1',
      showPopupPicker1: false,
      showPopupPicker2: false,
      showPopupPicker3: false,
      attentionType: '1' // 是否是预关注且确认书签署状态为未签署 0：是  1：否

    }
  },
  computed: { },
  methods: {
    back () {
      this.$publicFun.goBack(this)
    },
    onShow () {

    },
    onHide (type) {},
    onChange (val) {},
    testYzm () {
    },
    forginClick: function () {
      let n = this.forgin
      if (n === 1) {
        this.forgin = 0
      } else {
        this.forgin = 1
      }
    },
    gotoNext () {
      if (this.attentionType === '0') {
        this.$router.push({path: 'SettleExchangePromptLetter'})
      } else {
        console.error(this.buyExchangeAmt)
        this.$router.push({path: 'SettleExchangeConfirm'})
      }
    },
    refreshTest () {
      let LVm = this
      this.$bridge.callhandler('nativeRequest',
        JSON.stringify({'requstSource': 'internetRequest', 'url': 'http://whichat.icitic.net/mstep/mstep.do?act=business', 'params': {'method_Name': 'M0401010', 'basic_Data': {'PayAccount': '6217298009765555', 'BuyAmt': '2001'}}}),
        function (response) {
          response = JSON.parse(response)
          if (response.status === 0 || response.status === '0') {
            LVm.prdList = response.data.data
          } else {
            LVm.aaa = response.data.data
          }
        }
      )
      // this.$router.push({name: 'FinancialBuySure', query: {'PayAccount': '6217298009765555', 'BuyAmt': '2001'}})
    }
  },
  watch: {
  },
  created () {
    this.refreshTest()
  }
}
</script>
